#ifndef _XBENCH_COLORPRINT_HPP
#define _XBENCH_COLORPRINT_HPP

#include <ostream>
#include <string>
#include "xbench/state.hpp"

#ifdef WIN32
#include <windows.h>
#endif

namespace xbench{
    class Color{
    private:
        const int _value;
    public:
        explicit Color(const int value): _value(value){};

        static const Color Red, Green, Blue, Yellow, White;
        friend std::ostream& operator<<(std::ostream& os, const Color& color);
    };

    class ColorPrint{
    private:
        xbench::StateTable _table;
        int _name_length;
        double _total_nanoseconds;
        static constexpr int _duration_length = 15;
        static constexpr int _calls_length = 15;
        static constexpr int _ratio_length = 15;
        static constexpr int _min_name_length = 20;

        [[nodiscard]] int get_max_length() const;
        static std::string str_line(int size);
        void print_state(std::ostream& os, const xbench::State* state) const;
    public:
        explicit ColorPrint(xbench::StateTable table);
        friend std::ostream& operator<<(std::ostream& os, const ColorPrint& color_print);
    };
}

#endif //_XBENCH_COLORPRINT_HPP
